﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using QLTV_BLL;
using QLTV_Public;

namespace GUI
{
    public partial class uc_GhiTra : DevExpress.XtraEditors.XtraUserControl
    {
        #region Khai bao bien
        CT_PhieuYeuCau_BLL ct_bll = new CT_PhieuYeuCau_BLL();
        TextMessageBox box = new TextMessageBox();
        DataTable dt;
        bool isGV=true;
        #endregion

        #region LoadForm

        public uc_GhiTra()
        {
            InitializeComponent();
        }

        private void uc_TraTaiLieu_Load(object sender, EventArgs e)
        {
            Load_Data_GiaoVien();
        }

        #endregion

        #region cac chuc nang

        private void btnGhiTra_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            frmGhiTra frm = new frmGhiTra();
            frm.ShowDialog();
        }

        private void btnGiaoVien_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            isGV = true;
            Load_Data_GiaoVien();
        }

        private void btnHocVien_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            isGV = false;
            Load_Data_HocVien();
        }
        #endregion

        #region ham viet them
        private void Load_Data_GiaoVien()
        {
            gr_HocVien.Hide();
            gr_GiaoVien.Show();
            gr_GiaoVien.Dock = DockStyle.Fill;
            grd_GiaoVien.DataSource = ct_bll.TaoBang("SELECT * FROM dbo.Ds_GiaoVien_TraTaiLieu where TrangThaiMuon=0");
            grv_GiaoVien.BestFitColumns();
        }
        private void Load_Data_HocVien()
        {
            gr_GiaoVien.Hide();
            gr_HocVien.Show();
            gr_HocVien.Dock = DockStyle.Fill;
            grd_HocVien.DataSource = ct_bll.TaoBang("SELECT * FROM dbo.Ds_HocVien_TraTaiLieu where TrangThaiMuon=0");
            grv_HocVien.BestFitColumns();
        }

        #endregion

    }
}
